import { Injectable } from '@angular/core';
import { RequestService } from '../../../cores/services/request.service';
import { ApiData } from '../../../cores/classes/api-data.class';
import { SearchParams } from '../../../cores/classes/search-params';
import { Recharge } from '../interfaces/recharge.interfaces';
import { Observable } from 'rxjs';
import { Pagination } from 'ng-tui';
import { map } from 'rxjs/operators';


@Injectable()
export class RechargeService {

    constructor(private request: RequestService) { }

    /**
     * 部门列表
     */
    searchCrash(pagination: Pagination, search: SearchParams): Observable<ApiData> {
        return this.request.get('/managerapi/department/list', pagination.getpageDataWith(search.values));
    }
    /**
     * 删除部门列表
     */
    del(id: number): Observable<ApiData> {
        return this.request.delete('/managerapi/department/delete', { id });
    }

    /**
   * 添加部门列表
   * @param {Banner} banner 添加部门数据
   */
    insertBanner(banner: Recharge): Observable<ApiData> {
        return this.request.post('/managerapi/department/add', banner);
    }


    /**
   * 编辑
   * @param {Banner} banner 编辑数据
   */
    updateBanner(banner: Recharge): Observable<ApiData> {
        return this.request.put('/managerapi/department/update', banner);
    }
    /**
          /**
    * 获取公司列表 ,
    * @param ids 公司列表
    */
    company(): Observable<ApiData> {
        return this.request.url('/managerapi/company/list', );
    }
    /**
      /**
* 获取权限列表 ,
* @param ids 权限列表
*/
    permission(): Observable<ApiData> {
        return this.request.url('/managerapi/role/permission/get', );
    }
}
